package masterjava.common.client.gxt.highstock;

import com.extjs.gxt.ui.client.widget.Component;
import masterjava.common.client.gxt.base.tabs.BaseNamedTabs;

/**
 * User: gkislin
 * Date: 7/7/11
 */
abstract public class HighStockTabs<C extends Component & HighStockChartGetter> extends BaseNamedTabs<HighStockType, C> {
    private HighStockSeries[] seriesArray = null;

    public HighStockTabs(HighStockType tabItem) {
        super(tabItem);
    }

    public HighStockTabs(HighStockType[] tabItems) {
        super(tabItems);
    }

    public HighStockTabs(Iterable<HighStockType> tabIterable) {
        super(tabIterable);
    }

    public void setSeries(HighStockSeries... seriesArray) {
        this.seriesArray = seriesArray;
        for(C chart: getTabMap().values()){
            chart.getChart().setSeries(seriesArray);
        }
    }

    protected HighStockChart createChart(HighStockType type) {
        HighStockChart chart = new HighStockChart(type);
        chart.setSeries(seriesArray);
        return chart;
    }
}
